Integrand size = 11, antiderivative size = 73 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=-\frac {\text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}}-\frac {b \cos (x)-a \sin (x)}{2 \left (a^2+b^2\right ) (a \cos (x)+b \sin (x))^2} \]
[Out]
Time = 0.04 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3155, 3153, 212} \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=-\frac {\text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}}-\frac {b \cos (x)-a \sin (x)}{2 \left (a^2+b^2\right ) (a \cos (x)+b \sin (x))^2} \]
[In]
[Out]
Rule 212
Rule 3153
Rule 3155
Rubi steps \begin{align*} \text {integral}& = -\frac {b \cos (x)-a \sin (x)}{2 \left (a^2+b^2\right ) (a \cos (x)+b \sin (x))^2}+\frac {\int \frac {1}{a \cos (x)+b \sin (x)} \, dx}{2 \left (a^2+b^2\right )} \\ & = -\frac {b \cos (x)-a \sin (x)}{2 \left (a^2+b^2\right ) (a \cos (x)+b \sin (x))^2}-\frac {\text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (x)-a \sin (x)\right )}{2 \left (a^2+b^2\right )} \\ & = -\frac {\text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{2 \left (a^2+b^2\right )^{3/2}}-\frac {b \cos (x)-a \sin (x)}{2 \left (a^2+b^2\right ) (a \cos (x)+b \sin (x))^2} \\ \end{align*}
Result contains complex when optimal does not.
Time = 0.20 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.38 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=\frac {\left (a^2+b^2\right ) (-b \cos (x)+a \sin (x))+2 \sqrt {a^2+b^2} \text {arctanh}\left (\frac {-b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right ) (a \cos (x)+b \sin (x))^2}{2 (a-i b)^2 (a+i b)^2 (a \cos (x)+b \sin (x))^2} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. \(156\) vs. \(2(65)=130\).
Time = 0.53 (sec) , antiderivative size = 157, normalized size of antiderivative = 2.15
method | result | size |
default | \(-\frac {2 \left (-\frac {\left (a^{2}+2 b^{2}\right ) \tan \left (\frac {x}{2}\right )^{3}}{2 \left (a^{2}+b^{2}\right ) a}-\frac {b \left (a^{2}-2 b^{2}\right ) \tan \left (\frac {x}{2}\right )^{2}}{2 \left (a^{2}+b^{2}\right ) a^{2}}-\frac {\left (a^{2}-2 b^{2}\right ) \tan \left (\frac {x}{2}\right )}{2 \left (a^{2}+b^{2}\right ) a}+\frac {b}{2 a^{2}+2 b^{2}}\right )}{\left (\tan \left (\frac {x}{2}\right )^{2} a -2 b \tan \left (\frac {x}{2}\right )-a \right )^{2}}+\frac {\operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\) | \(157\) |
risch | \(\frac {{\mathrm e}^{i x} \left (i a \,{\mathrm e}^{2 i x}+b \,{\mathrm e}^{2 i x}-i a +b \right )}{\left (b \,{\mathrm e}^{2 i x}+i a \,{\mathrm e}^{2 i x}-b +i a \right )^{2} \left (-i a +b \right ) \left (i a +b \right )}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i a^{3}+i a \,b^{2}-a^{2} b -b^{3}}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\right )}{2 \left (a^{2}+b^{2}\right )^{\frac {3}{2}}}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {i a^{3}+i a \,b^{2}-a^{2} b -b^{3}}{\left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\right )}{2 \left (a^{2}+b^{2}\right )^{\frac {3}{2}}}\) | \(187\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 225 vs. \(2 (65) = 130\).
Time = 0.26 (sec) , antiderivative size = 225, normalized size of antiderivative = 3.08 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=\frac {{\left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right )} \sqrt {a^{2} + b^{2}} \log \left (-\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - b^{2} + 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (x\right ) - a \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}}\right ) - 2 \, {\left (a^{2} b + b^{3}\right )} \cos \left (x\right ) + 2 \, {\left (a^{3} + a b^{2}\right )} \sin \left (x\right )}{4 \, {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6} + {\left (a^{6} + a^{4} b^{2} - a^{2} b^{4} - b^{6}\right )} \cos \left (x\right )^{2} + 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \cos \left (x\right ) \sin \left (x\right )\right )}} \]
[In]
[Out]
Exception generated. \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=\text {Exception raised: AttributeError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 250 vs. \(2 (65) = 130\).
Time = 0.33 (sec) , antiderivative size = 250, normalized size of antiderivative = 3.42 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=-\frac {a^{2} b - \frac {{\left (a^{3} - 2 \, a b^{2}\right )} \sin \left (x\right )}{\cos \left (x\right ) + 1} - \frac {{\left (a^{2} b - 2 \, b^{3}\right )} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} - \frac {{\left (a^{3} + 2 \, a b^{2}\right )} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}}}{a^{6} + a^{4} b^{2} + \frac {4 \, {\left (a^{5} b + a^{3} b^{3}\right )} \sin \left (x\right )}{\cos \left (x\right ) + 1} - \frac {2 \, {\left (a^{6} - a^{4} b^{2} - 2 \, a^{2} b^{4}\right )} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} - \frac {4 \, {\left (a^{5} b + a^{3} b^{3}\right )} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}} + \frac {{\left (a^{6} + a^{4} b^{2}\right )} \sin \left (x\right )^{4}}{{\left (\cos \left (x\right ) + 1\right )}^{4}}} - \frac {\log \left (\frac {b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{2 \, {\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 166 vs. \(2 (65) = 130\).
Time = 0.30 (sec) , antiderivative size = 166, normalized size of antiderivative = 2.27 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=-\frac {\log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{2 \, {\left (a^{2} + b^{2}\right )}^{\frac {3}{2}}} + \frac {a^{3} \tan \left (\frac {1}{2} \, x\right )^{3} + 2 \, a b^{2} \tan \left (\frac {1}{2} \, x\right )^{3} + a^{2} b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b^{3} \tan \left (\frac {1}{2} \, x\right )^{2} + a^{3} \tan \left (\frac {1}{2} \, x\right ) - 2 \, a b^{2} \tan \left (\frac {1}{2} \, x\right ) - a^{2} b}{{\left (a^{4} + a^{2} b^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b \tan \left (\frac {1}{2} \, x\right ) - a\right )}^{2}} \]
[In]
[Out]
Time = 21.69 (sec) , antiderivative size = 216, normalized size of antiderivative = 2.96 \[ \int \frac {1}{(a \cos (x)+b \sin (x))^3} \, dx=\frac {\frac {{\mathrm {tan}\left (\frac {x}{2}\right )}^3\,\left (a^2+2\,b^2\right )}{a\,\left (a^2+b^2\right )}-\frac {b}{a^2+b^2}+\frac {\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^2-2\,b^2\right )}{a\,\left (a^2+b^2\right )}+\frac {b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2\,\left (a^2-2\,b^2\right )}{a^2\,\left (a^2+b^2\right )}}{a^2-{\mathrm {tan}\left (\frac {x}{2}\right )}^2\,\left (2\,a^2-4\,b^2\right )+a^2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^4+4\,a\,b\,\mathrm {tan}\left (\frac {x}{2}\right )-4\,a\,b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3}-\frac {\mathrm {atanh}\left (-\frac {\left (2\,a\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {2\,a^2\,b+2\,b^3}{a^2+b^2}\right )\,\left (\frac {a^2}{2}+\frac {b^2}{2}\right )}{{\left (a^2+b^2\right )}^{3/2}}\right )}{{\left (a^2+b^2\right )}^{3/2}} \]
[In]
[Out]